<template>
	<view class="page-content">
		<block v-if="newsInfo!={}">
			<view class="news-title">{{ newsInfo.title }}</view>
			<view class="news-tip flex flex-row"> 
				<text>发布日期：{{ newsInfo.publishdate | timeFormat("YYYY-MM-DD") }}</text>
				<text>浏览人数：{{ newsInfo.viewTotal || 0 }}</text> 
			</view>
			<!-- <image v-if="newsInfo.fileUrl" :src="newsInfo.fileUrl" mode="widthFix" class="news-img"></image> -->
			<rich-text :nodes="newsInfo.newdetail" class="news-content"></rich-text>
			<view v-if="newsInfo.newsource" class="news-tip" style="text-align: right;"><text>来源：{{ newsInfo.newsource }}</text></view>
		</block>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id: '',
				newsInfo:{}
			}
		},
		onLoad(option) {
			this.id = option.id
			this.getNewsInfo()
		},
		methods: {
			getNewsInfo() {
				this.$$.request({
					url: this.config.getNewsById,
					data: {
						id:this.id
					},
					method: "POST"
				}, true, true).then((res) => {
					this.newsInfo = res.data.rows
				}).catch((Error) => {
					console.log(Error.msg)
				}).finally(() => {
				
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.page-content {
		padding: 60upx 30upx;
	}

	.news-title {
		margin-bottom: 40upx;
		font-size: 40upx;
		font-weight: bold;
		color: $uni-text-color;
		line-height: 64upx;
		text-align: center;
	}

	.news-tip {
		margin-bottom: 60upx;
		justify-content: space-between;
		uni-text {
			margin-right: 30upx;
			font-size: 24upx;
			color: $uni-text-color-grey;
		}
	}

	.news-img {
		margin-bottom: 40upx;
		width: 690upx;
		height: 476upx;
	}

	.news-content {
		font-size: 36upx;
		font-weight: 500;
		color: $uni-text-color;
		line-height: 56upx;
		/deep/ img {
			width: 100%;
		}
		/deep/ p {
			word-break: break-all;
		}
	}
</style>
